package com.pingan.stat.reposys.money24.service;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.annotation.Resource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component;

import com.pingan.common.core.property.Properties;
import com.pingan.common.util.ShellExecutor;
import com.pingan.stat.service.StatService;

@Component
public class LoanPagesSEMStatService implements StatService {

	@Properties(name = "reposys.loan.pages.output.path")
	private String outputPath;

	@Properties(name = "reposys.loan.sem")
	private String loanPagesSemStatShell;

	@Resource
	private ShellExecutor shellExecutor;

	private static final Log log = LogFactory.getLog("hive");

	@Override
	public void dailyStat(Date date) {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
		String yyyyMMdd = sdf.format(date);
		String output = outputPath + "/" + yyyyMMdd;

		log.info("----------------->>>>>>>>>>>>>>>>>> stat loan pages SEM ");
		String[] params = new String[] { yyyyMMdd, output };
		shellExecutor.excecute(loanPagesSemStatShell, params);

	}

}
